<template>
	<view class="wrap">
		<view class="order-list" v-for="(item,index) in orderList" :key="item.id" v-if="item.flag=='1'"
			@click="navTo(item.url)">
			<view class="order-left">
				<u-icon :name="item.icon" color="#2979ff" size="48"></u-icon>
				<view>{{item.orderName}}</view>
			</view>
			<view class="order-right">
				<u-icon name="arrow-right" color="#333" size="34"></u-icon>
			</view>
		</view>
	</view>
</template>
<script>
	import icon from "static/aidex/tabbar/baojing_1.png"
	export default {
		data() {
			return {
				keywords: '',
				orderList: [{
						id: 0,
						orderName: "事件工单",
						icon: 'order',
						url: '/pages/sys/eventwororder/eventorder/eventOrder',
						flag: '1'
					},
					{
						id: 1,
						orderName: "事件申报",
						icon: 'photo',
						url: '/pages/sys/eventwororder/adddeclaration/adddeclaration',
						flag: '1'
					},
					{
						id: 2,
						orderName: "事件调度",
						icon: 'bag',
						url: '/pages/sys/order/newScheduling',
						flag: '1'
					},
					{
						id: 3,
						orderName: "巡检工单",
						icon: 'coupon',
						url: '/pages/sys/order/pollingManage/index',
						flag: '1'
					},

					{
						id: 4,
						orderName: "实时报警",
						icon: 'error-circle-fill',
						url: '/pages/sys/home/index',
						flag: '0'
					},
					{
						id: 5,
						orderName: "保养工单",
						icon: 'bell',
						url: '/pages/sys/order/upkeepOrder',
						flag: '1'
					},


				]
			}
		},
		onLoad() {

		},
		created() {
			//调用逻辑编排的方法判断是否有实时报警的页面
			this.getBjflag();
		},
		methods: {
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			getBjflag() {
				this.$u.api.searchNotdo({
					"algorithmProcessId": "getBj",
					"param": {
						"data": {
							user_uuid: uni.getStorageSync('uuid'), //用户id
						}
					}
				}).then(res => {
					this.orderList[4].flag = res.data.flag;
				}).catch(error => {
					this.$u.toast('查询异常');
					console.error(error);
				});
			}
		}
	};
</script>
<style lang="scss" scoped>
	@import 'style/index.css';
</style>